// mytime.h -- Time class before operator overloading

#ifndef STARTCPP_MYTIME_H
#define STARTCPP_MYTIME_H 0x03

#include <iostream>

class Time {
private:
    int hours;
    int minutes;
public:
    Time();
    Time(int h, int m = 0);
    void AddMin(int m);
    void AddHr(int h);
    void Reset(int h = 0, int m = 0);
    // [[nodiscard]]是一种函数属性，它告诉编译器函数的返回值不应该被忽略。这在那些依赖于返回值的函数中尤为有用，例如谓词函数或工厂函数。
    [[nodiscard]] Time Sum(const Time &t) const;
    Time operator+(const Time &t) const;
    Time operator-(const Time &t) const;
    Time operator*(double mult) const;
    friend Time operator*(double m, const Time &t) { return t * m; }    // inline definition
    friend std::ostream & operator<<(std::ostream &os, const Time &t);
    void Show() const;
};


#endif //STARTCPP_MYTIME_H
